package com.ruoyi.common.wx.Service;

import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
import com.ruoyi.common.wx.config.WxMaConfiguration;
import org.springframework.stereotype.Service;

/**
 * @Description
 * @Author YangJun
 * @Date 2021年11月4日 17:41:23
 **/
@Service
public class WxUserService {
    /**
     * <pre>
     * 获取用户绑定手机号信息
     * </pre>
     */
    public com.ruoyi.common.core.web.domain.AjaxResult getUserPhone(String sessionKey, String encryptedData, String iv) {
        final WxMaService wxService = WxMaConfiguration.getMaService();

        // 解密
        WxMaPhoneNumberInfo phoneNoInfo = wxService.getUserService().getPhoneNoInfo(sessionKey, encryptedData, iv);
        return com.ruoyi.common.core.web.domain.AjaxResult.success(phoneNoInfo);
    }
}
